package com.yc.fedex.model.request.ship;

import com.yc.fedex.model.domain.AccountNumber;
import lombok.Data;

@Data
public class CancelShipmentRequest {

    private AccountNumber accountNumber;
    private String emailShipment;
    private String senderCountryCode;
    private String deletionControl;
    private String trackingNumber;

    private CancelShipmentRequest(Steps steps) {
        this.accountNumber = steps.accountNumber;
        this.trackingNumber = steps.trackingNumber;
    }

    public static AccountNumberStep request() {
        return new Steps();
    }

    public interface AccountNumberStep {
        TrackingNumberStep accountNumberStep(String accountNumber);
    }

    public interface TrackingNumberStep {
        Build trackingNumberStep(String trackingNumber);
    }

    public interface Build {
        CancelShipmentRequest build();
    }

    public static class Steps implements AccountNumberStep, TrackingNumberStep, Build {

        private AccountNumber accountNumber;

        private String trackingNumber;

        @Override
        public TrackingNumberStep accountNumberStep(String accountNumber) {
            this.accountNumber = new AccountNumber(accountNumber);
            return this;
        }

        @Override
        public Build trackingNumberStep(String trackingNumber) {
            this.trackingNumber = trackingNumber;
            return this;
        }

        @Override
        public CancelShipmentRequest build() {
            return new CancelShipmentRequest(this);
        }
    }

}
